package com.course.service.impl;

import com.course.entity.ResultBody;
import com.course.mapper.LoginMapper;
import com.course.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginMapper loginMapper;
    @Override
    public ResultBody loginuser(String userstyle, String usernumber, String userpassword)
    {
        if(loginMapper.loginuser(userstyle,usernumber,userpassword)==null)
            return new ResultBody(400,"登陆失败,信息不匹配",false);
        else
            return new ResultBody(200,"登陆成功",loginMapper.loginuser(userstyle,usernumber,userpassword));
    }
    @Override
    public ResultBody loginadmin(Map<String,Object>map)
    {
        if(loginMapper.loginadmin(map)==null)
            return new ResultBody(400,"登陆失败,信息不匹配",false);
        else
            return new ResultBody(200,"登陆成功",loginMapper.loginadmin(map));
    }
}
